import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('@/Layout'),
    children: [
      {
        path: '/',
        name: 'home',
        component: () => import('@/views/home')
      },
      {
        path: '/product', // 产品管理
        name: 'product',
        component: () => import('@/views/product'),
        children: [
          {
            path: 'list',
            name: 'list',
            component: () => import('@/views/product/components/List')
          },
          {
            path: 'category',
            name: 'category',
            component: () => import('@/views/product/components/CateGory')
          }
        ]
      },
      {
        path: '/order', // 订单管理
        name: 'order',
        component: () => import('@/views/order'),
        children: [
          {
            path: 'list',
            name: 'list',
            component: () => import('@/views/order/components/list')
          },
          {
            path: 'collect',
            name: 'collect',
            component: () => import('@/views/order/components/collect')
          }
        ]
      },
      {
        path: '/advert', // 广告分类
        name: 'advert',
        component: () => import('@/views/advert'),
        children: [
          {
            path: 'list',
            name: 'list',
            component: () => import('@/views/advert/components/list')
          }
        ]
      }

    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login')
  }
]

const router = new VueRouter({
  routes
})

export default router
